#pragma once
#include "afxcmn.h"
#include "afxwin.h"

#include "QuestionWindow.h"
#include "Core/QuestionAndAnswer.h"
#include "SafeRichEditCtrl.h"
// CTypingWindow dialog

class CTypingWindow : public CQuestionWindow
{
    DECLARE_DYNAMIC(CTypingWindow)

public:
    CTypingWindow(CWnd* pParent = NULL);   // standard constructor
    virtual ~CTypingWindow();

// Dialog Data
    enum { IDD = IDD_TypingQuestion };

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

    DECLARE_MESSAGE_MAP()

    CSafeRichEditCtrl m_editQuestion;
    CSafeRichEditCtrl m_editAnswer;
    CStatic m_staticRestTime;

    ExamSystem::CTypingQuestion m_question;
    ExamSystem::CTypingAnswer m_answer;

    unsigned int m_restTime;
    unsigned int m_endTime;

    CString m_questionTyping;

    bool m_flagTimerStarted;

    CHARFORMAT2 m_cfRed;
    CHARFORMAT2 m_cfBlue;

    void PreProcessString(CString &str);

    virtual void OnOK();
    virtual void OnCancel();
public:
    virtual void ShowQuestion(void);
    virtual void SaveAndHide(void);
    virtual void Initialize(void);
    virtual BOOL OnInitDialog();
    afx_msg void OnEnChangeRicheditanswer();
    afx_msg void OnTimer(UINT_PTR nIDEvent);
};
